
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <link href="/static/devtools30/layui/css/layui.css" rel="stylesheet" />
    <link href="/static/devtools30/css/devindexbase.css" rel="stylesheet" />
    <script src="/static/devtools30/js/jquery-1.11.2.min.js" type="text/javascript"></script>
    <script src="/static/devtools30/layui/layui.all.js" type="text/javascript"></script>
    <script src="/static/devtools30/js/devtoolCommon.js" type="text/javascript"></script>
    <title>新增功能</title>
    <style>
        /*页面内边距*/
        .addwrap {
            padding: 30px;
        }
        /*按钮组边框*/
        .layui-btn-primary {
            border: 1px solid #C9C9C9!important;
        }
        /*输入框高度*/
        .addwrap .layui-input,
        .layui-select {
            height: 25px;
        }

        .addwrap .layui-input-block {
            min-height: 26px;
            margin-left: 30px;
        }

        .addwrap .layui-form-label {
            padding: 0;
            text-align: right;
            height: 26px;
            line-height: 26px;
            width: 80px;
        }
        .layui-form-radio>i {
            font-size: 17px !important;
        }
        .layui-form-radio {
            line-height: 12px !important;
        }
        .layui-form-radio * {
            font-size: 12px;
        }
        .layui-form-item .layui-form-checkbox[lay-skin=primary] {
            margin-top: 3px !important;
        }
        .layui-form-checkbox span {

            font-size: 12px !important;
        }
    </style>
</head>
<body>
<div class="addwrap">
    <di class="layui-form" lay-filter="form" >

        <input type="hidden" name="id" id="id" class="layui-input" th:value="${data.id}">


        <div class=" height26" style="width: 600px ">
            <div class="layui-form-item flex">
                <label class="layui-form-label">序号</label>
                <div class="layui-input-block marginleft10">
                    <input  id="xh" name="xh" type="number" th:value="${data.xh}"  lay-verify="required" lay-reqtext="序号不能为空" placeholder="请输入序号" autocomplete="off" class="layui-input" style="width: 188px">

                </div>
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block marginleft10" >
                    <input type="text" name="name" id="name" th:value="${data.name}" placeholder="请输入名称" autocomplete="off" class="layui-input" style="width: 188px">

                </div>
            </div>

        </div>


        <div class=" height26" style="width: 600px ">
            <div class="layui-form-item flex">
                <label class="layui-form-label">分类</label>
                <div class="layui-input-block marginleft10">
                    <select name="typeId" id="typeId" lay-verify="required" >
                        <option th:each="c : ${typeList}"  th:value="${c.id}" th:utext="${c.name}">
                        </option>
                    </select>
                </div>

                <label class="layui-form-label">模型</label>
                <div class="layui-input-block marginleft10" >
                    <select name="tableId" id="tableId" lay-verify="required" >
                        <option th:each="c : ${mtableList}"  th:value="${c.id}" th:utext="${c.name}" th:selected="${mtableid} eq ${c.id} ">
                        </option>
                    </select>
                </div>
            </div>

        </div>

        <div class=" height26" style="width: 600px ">
            <div class="layui-form-item flex">
                <label class="layui-form-label">表头行数</label>
                <div class="layui-input-block marginleft10">
                    <input  id="headNum" name="headNum" type="number" th:value="${data.headNum}"  lay-verify="required" lay-reqtext="表头行数不能为空" placeholder="请输入表头行数" autocomplete="off" class="layui-input" style="width: 188px">

                </div>
                <label class="layui-form-label">数据行数</label>
                <div class="layui-input-block marginleft10">
                    <input  id="dataNum" name="dataNum" type="number" th:value="${data.dataNum}"  lay-verify="required" lay-reqtext="数据行数不能为空" placeholder="请输入数据行数" autocomplete="off" class="layui-input" style="width: 188px">

                </div>
            </div>

        </div>






        <div class="layui-form-item layui-form-text flex">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block" style="width: 490px!important;">
                <textarea name="bz" id="bz" placeholder="请输入备注" class="layui-textarea">[(${data.bz})]</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block flex flex-jusity-around tjbtn">
                <button class="layui-btn layui-btn-radius layui-btn-sm layui-btn-primary qx" onclick="closeWin()">取消</button>
                <button class="layui-btn layui-btn-radius layui-btn-sm " lay-submit lay-filter="save">保存</button>
            </div>
        </div>
    </di>
</div>
</body>
<script>
    $(function(){
        initEvent();
    });
    function closeWin(){
        dlCommon.closeParentLayer();
    }

    function initEvent(){
        layui.form.on('submit(save)', function(data){
            saveData();
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        if(dlCommon.getUrlParam("typeId")){
            $("#typeId option[value='"+dlCommon.getUrlParam("typeId")+"']").attr("selected", "selected");
        }
        $("#typeId option[value='[(${data.typeId})]']").attr("selected", "selected");

        layui.form.render();
    }
    function saveData(){
        var data = layui.form.val('form');

        dlCommon.post("/DevtExcelController/save",data,function(res){
            if(!res.success){
                dlCommon.layerError(res.msg);
                return;
            }
            dlCommon.layerSuccess("保存成功",function(){
                parent.getDataList();
                closeWin();
            })
        },true)
    }
</script>

</html>